﻿using UnityEngine;
using System.Collections;

public class JiGuang : MonoBehaviour {


	public GameObject obj1;
	public GameObject obj2;

	//移动初始化值
	float m_y1 = 0.58f;
	float m_y2 = -10.78f;
	//移动速度
	float m_speed = 25;
	Transform m_transform;
	void Start () {
	
		m_transform = this.transform;
		obj1.transform.position = new Vector3(m_transform.position.x ,0.58f,0);
		obj2.transform.position = new Vector3(m_transform.position.x,-10.78f,0);
	}

	void Update () {
	
		m_y1+=Time.deltaTime*m_speed;
		m_y2+=Time.deltaTime*m_speed;
		if(m_y1>=12.8f)
		{
			m_y1 = -10.78f;
		}
		if(m_y2>=12.8f)
		{
			m_y2 = -10.78f;
		}
		obj1.transform.position = new Vector3(m_transform.position.x,m_y1,0);
		obj2.transform.position = new Vector3(m_transform.position.x,m_y2,0);
	}
}
